

from flask import Flask
from flask_cors import CORS
from views.Login import login
from views.Inquiry import inqu
from models.Inquiry_model import db
from apscheduler.schedulers.background import BackgroundScheduler


def create_app(config):
    flask_app = Flask(__name__)

    # 挂载：
    flask_app.config.from_object(config)

    # 跨域：
    resp = CORS(flask_app)

    yi = BackgroundScheduler()
    flask_app.pas = yi
    flask_app.pas.start()

    # 注册蓝图：
    flask_app.register_blueprint(login)
    flask_app.register_blueprint(inqu)

    # 初始化模型类
    db.init_app(flask_app)


    return flask_app









